/**
 * Created by hythzx on 2016/1/18.
 */
Ext.define('OrderConvert.view.order.OrderController', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.order',

    /**
     * Called when the view is created
     */
    init: function() {

    },
    
     requires : [
        "OrderConvert.controller.order.OrderController"
    ],

    addOrder : function (btn) {
        var orderController = Ext.create("OrderConvert.controller.order.OrderController");
        var form = btn.up("form");
        if(form.isValid()) {
            form.submit({
                url : OrderConvertUrl.constant.serverUrl + 'order/add',
                waitMsg: '文件上传中...',
                success: function(form, action) {
                    form.getForm().reset();
                    // Ext.Msg.alert('Success',"success");
                    orderController.reloadGridData();
                },
                failure: function(form, action) {
                    // console.log(action);
                    // Ext.Msg.alert('Failed', "failure");
                    form.getForm().reset();
                    orderController.reloadGridData();
                }
            });
        }
    }

});